Skip to content

feat!: register direct editors for the mobile apps - #115

Open
juliusknorr wants to merge 3 commits into
mainfrom
feat/register-direct-editor
Open

juliusknorr wants to merge 3 commits into
mainfrom
feat/register-direct-editor

Conversation

@juliusknorr

@juliusknorr juliusknorr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Makes this library ready to use and publish as @nextcloud/directediting 1.0.0, so direct editors (Text, Collabora Online, Whiteboard, Nextcloud Office) and the mobile apps share one API instead of a special case per editor (files-clients#137).

  • registerDirectEditor() exposes the editor's optional hooks (close, insertAsset, focus) as OCP.DirectEditing for the mobile apps. close() always ends with the close message, also if saving fails or takes over 10 s
  • sendMobileMessage() replaces the helper every editor copied, typed per message
  • Replaces the unpublished 2022 API and moves to the current nextcloud-libraries setup (tsc, vitest, eslint, org workflows), like @nextcloud/initial-state
  • README explains usage for editors and mobile apps

Tests: 23 vitest tests, 100% coverage.

Mobile apps had to special-case every direct editor to close it, and
each editor copied its own helper to send messages to the apps.

- registerDirectEditor() exposes the editor's optional hooks (close,
  insertAsset, focus) as OCA.DirectEditing. close() runs the hook, at
  most 10 s by default, then always sends `close` and resolves, also on
  failure. A second call returns the same promise
- sendMobileMessage() sends typed messages to Android and iOS, with the
  payloads documented in the developer manual
- Replace the unpublished DirectEditEmit and DirectEditListen classes,
  which used an interface name and a postMessage listener the apps
  never implemented
- Build with tsc, test with vitest, lint with @nextcloud/eslint-config
  and use the current organization workflows, like
  @nextcloud/initial-state. Publish as @nextcloud/directediting

Refs: nextcloud/files-clients#137
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5
@juliusknorr juliusknorr added 3. to review Waiting for reviews enhancement New feature request javascript Pull requests that update javascript code AI assisted This PR contains AI-assisted commits labels Dec 2, 2026
@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Signed-off-by: Julius Knorr <jus@bitgrid.net>
No-test: docs only
Assisted-by: ClaudeCode:claude-opus-5-5
@juliusknorr
juliusknorr marked this pull request as ready for review December 2, 2026 08:30
The contract belongs to the server's OCP\DirectEditing, so the global
mirrors it. Editors like richdocuments handle messages posted to their
own page, so a self-posted close would trigger another close.

Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5
@juliusknorr

juliusknorr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Also @moodyjmz for review (invited you to the org as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted This PR contains AI-assisted commits enhancement New feature request javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant